import _ from 'lodash'
import { echartsStyle, constValue } from '@/config/echartsStyle'
export const lineBarOption = {
  tooltip: {
    trigger: 'axis',
    axisPointer: {
      type: 'none',
    },
  },
  backgroundColor: echartsStyle.backgroundColor,
  legend: echartsStyle.legend,
  grid: echartsStyle.grid,
  xAxis: _.assign({ type: 'category' }, echartsStyle.xAxisObj),
  yAxis: [
    _.assign(
      {
        type: 'value',
        show: false,
        position: 'left',
        splitNumber: constValue.splitNumber,
      },
      echartsStyle.yAxisObj
    ),
    _.assign(
      {
        type: 'value',
        show: false,
        position: 'right',
        splitNumber: constValue.splitNumber,
      },
      echartsStyle.yAxisObj
    ),
  ],
  series: [
    _.assign(
      {
        type: 'line',
      },
      echartsStyle.seriesLineObj('#1455FD', '#7D9EF4')
    ),
    _.assign(
      {
        type: 'bar',
        yAxisIndex: 1,
      },
      echartsStyle.seriesBarObj('#A3E083', '#48D3A9')
    ),
  ],
} //折线加柱状
export const barOption = {
  tooltip: {
    formatter: function (params) {
      return (
        params.name +
        '<br>' +
        params.marker.replace(
          /\[object Object\]/,
          params.color.colorStops[0].color
        ) +
        params.seriesName +
        ':' +
        params.data
      )
    },
  },
  backgroundColor: echartsStyle.backgroundColor,
  legend: echartsStyle.legend,
  grid: echartsStyle.grid,
  xAxis: _.assign({ type: 'category' }, echartsStyle.xAxisObj),
  yAxis: [
    _.assign(
      {
        type: 'value',
        show: false,
        splitNumber: constValue.splitNumber,
        min: 0,
      },
      echartsStyle.yAxisObj
    ),
  ],
  series: [
    _.assign(
      {
        type: 'bar',
      },
      echartsStyle.seriesBarObj('#A3E083', '#48D3A9')
    ),
  ],
} //柱状
